package com.hfuu.demo.exception;

import com.hfuu.demo.domain.vo.ResponseResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @description:
 * @author: gunala
 * @date: 2024/2/4 15:55
 */
@RestControllerAdvice
@Slf4j
public class DefaultException {

    @ExceptionHandler(RuntimeException.class)
    public ResponseResult usernameNotFoundException(RuntimeException e){
        log.error("发送了错误，错误信息为{}",e.getMessage());
        return new ResponseResult(401,"用户名或密码错误");
    }

}
